package com.yc.sakuralxm.uestcscanning;

import android.app.Activity;
import android.app.Instrumentation;
import android.support.v4.app.FragmentActivity;
import android.view.KeyEvent;
import android.view.View;
import android.widget.TextView;


/**
 * Created by Administrator on 2016/9/2.
 */
public class BaseFragmentActivity extends FragmentActivity {
//    @Override
//    protected void onResume() {
//        super.onResume();
//        MobclickAgent.onResume(this);       //统计时长
//    }
//
//    @Override
//    protected void onPause() {
//        super.onPause();
//        MobclickAgent.onPause(this);
//    }

    public void toBack(View view) {
        //模拟返回键来实现退出或者关闭输入法
        new Thread() {
            @Override
            public void run() {
                Instrumentation inst = new Instrumentation();
                inst.sendKeyDownUpSync(KeyEvent.KEYCODE_BACK);
            }
        }.start();
    }

    public BaseFragmentActivity getActivity() {
        return this;
    }

    @Override
    public void setTitle(CharSequence title) {
        SetTitle(this, title);
    }

    public static void SetTitle(Activity activity, CharSequence title) {
//        View view = activity.findViewById(R.id.idActionBarTv);
//        if (view instanceof TextView) {
//            ((TextView) view).setText(title);
//        }
    }

    public void setSureText(CharSequence title) {
        SetSureText(this, title);
    }

    public static void SetSureText(Activity activity, CharSequence title) {
//        View view = activity.findViewById(R.id.idActionBarSureTv);
//        if (view instanceof TextView) {
//            ((TextView) view).setText(title);
//        }
    }
}
